﻿Imports Microsoft.TeamFoundation.WorkItemTracking.Client
Imports System.ComponentModel

Namespace Model


    Public Class ProjectViewModel
        Implements INotifyPropertyChanged


        Private m_Project As Project
        Private m_IsChecked As Boolean

        Public Sub New(ByVal project As Project)
            m_Project = project
        End Sub

        Public ReadOnly Property Project() As Project
            Get
                Return m_Project
            End Get
        End Property

        Public ReadOnly Property Name() As String
            Get
                Return m_Project.Name
            End Get
        End Property

        Public Property IsChecked() As Boolean
            Get
                Return m_IsChecked
            End Get
            Set(ByVal value As Boolean)
                If Not value = m_IsChecked Then
                    m_IsChecked = value
                    OnPropertyChanged("IsChecked")
                End If
            End Set
        End Property

#Region " INotifyPropertyChanged "

        Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

        Public Sub OnPropertyChanged(ByVal PropertyName As String)
            If Not Application.Current.Dispatcher.CheckAccess Then
                Application.Current.Dispatcher.Invoke(New Action(Of String)(AddressOf OnPropertyChanged), PropertyName)
            End If
            If Not PropertyChangedEvent Is Nothing Then
                RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(PropertyName))
            End If
        End Sub

#End Region

    End Class

End Namespace